<template>
<view>
  {{ imgText }}
</view>
</template>
<script setup lang="ts">
import { createWorker } from 'tesseract.js';
import {ref} from "vue";
const imgText = ref('')
const getOrc = () =>{
  return new Promise( async(resolve, reject)=>{
      const worker = await createWorker('eng');
      const ret = await worker.recognize('https://tesseract.projectnaptha.com/img/eng_bw.png');
      console.log(ret.data.text);
      await worker.terminate();
      resolve(ret.data.text)
  })

}
onLoad( async ()=>{
  imgText.value = await getOrc() as any
})

</script>
<style scoped lang="scss">

</style>